package probe.sound.spring;

import probe.sound.core.Producer;
import probe.sound.core.Syn;
import probe.sound.core.SynPlay;
import probe.sound.core.Value;

public class One implements Producer {
  public static void main(String[] args) {
    Syn syn = new SynPlay();
    syn.setProducer( new One() );
    syn.setTimeDelay( 2 );
    
    syn.run();
  }
  
  private static final double PI2 = Math.PI * 2.0;
  
  @Override
  public void produce(Value value, double t) {
    double x = 0;
    
    double A1 = 0.01;
    double Hz = 500;
    
    x += (A1 / 1) * Math.sin( Hz * 1 * PI2 * t );
    x += (A1 / 1) * Math.sin( Hz * 2 * PI2 * t );
    x += (A1 / 1) * Math.sin( Hz * 3 * PI2 * t );
    x += (A1 / 1) * Math.sin( Hz * 4 * PI2 * t );
    x += (A1 / 1) * Math.sin( Hz * 5 * PI2 * t );
    x += (A1 / 1) * Math.sin( Hz * 6 * PI2 * t );
    
    value.left = value.right = x;
  }
}
